package com.qiyun.duijiang.utils;

import java.text.SimpleDateFormat;
import java.util.*;

public class TimeUtil {
    private static SimpleDateFormat format=new SimpleDateFormat("yyyyMMdd");
    private static SimpleDateFormat formatNow=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    private static Calendar calendar=Calendar.getInstance();

    /**
     *当前时间2小时前
     */
    public static String time2(){
        calendar.set(Calendar.HOUR_OF_DAY, calendar.get(Calendar.HOUR_OF_DAY) - 2);
        return  formatNow.format(calendar.getTime());
    }

    public static String dayX(){return formatNow.format(new Date());}
}
